<style type="text/css">
.content{position:relative}
.content .large{position:absolute;top:60px;left:50%;margin-left:-47px;width:95px;height:95px;border-radius:50%;background-color:#f4e3cd;-webkit-animation-name:largeAnimation;-webkit-animation-duration:2s;-webkit-animation-timing-function:ease-out;-webkit-animation-iteration-count:infinite;-webkit-animation-direction:normal}
.content .middle{position:absolute;width:95px;top:60px;left:50%;margin-left:-47px;height:95px;border-radius:50%;background-color:#fad099;-webkit-animation-name:middleAnimation;-webkit-animation-duration:2s;-webkit-animation-timing-function:ease-out;-webkit-animation-iteration-count:infinite;-webkit-animation-direction:normal}
.content .small{position:absolute;top:60px;left:50%;margin-left:-47px;width:95px;height:95px;border-radius:50%;background-color:#fd8926;display:-webkit-box;-webkit-box-align:center;-webkit-box-pack:center}.content .small p{color:#fff;font-size:12px;text-align:center;line-height:26px}
.content .small p span{font-size:27px;padding-top:10px}@-moz-keyframes middleAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(1.63)}}@-webkit-keyframes middleAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(1.63)}}@-o-keyframes middleAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(1.63)}}@keyframes middleAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(1.63)}}@-moz-keyframes largeAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(2.21)}}@-webkit-keyframes largeAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(2.21)}}@-o-keyframes largeAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(2.21)}}@keyframes largeAnimation{0%{-webkit-transform:scale(1)}100%{-webkit-transform:scale(2.21)}}
</style>
<div class="fui-page order-create-page fui-page-current">
	<div class="fui-content" style="padding-bottom:0">
		<div id="allmap" style="height: {{page.height || '800'}}px;padding:0px 0px;width: 100%"></div>
		<div class="fui-title-c" style="top:10rem;position:absolute;left:50%" ng-if="pagedata.info.show==0">
			<div class="weui_icon_area">
				<div class="content">
					<div ng-if="pagedata.store.busy==1" class="large"></div>
					<div ng-if="pagedata.store.busy==1" class="middle"></div>
					<div class="small {{pagedata.store.busy!=1?'offline':''}}">
						<div>
							<div style="color:#fff">{{pagedata.store.busy==1?'听单中':'休息中'}}</div>
							<div ng-if="pagedata.store.busy==1" class="time j_timeClock" style="color:#fff">0:0:0</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('shop/_orderitem')"></div>
<div class="fui-navbar-top" style="height: 2.5rem;">
	<div class="fui-list-group merchgroup" style="margin-top:0">
			<div class="fui-list jump">
                <a class="fui-list-media">
                    <img style="border-radius: 10%;" ng-src="{{tomedia(pagedata.store.image) ||'../core/resource/images/nopic.jpg'}}" />
                </a>
                <div class="fui-list-inner">
                    <div class="title"><i class="icon icon-wo1" style="color:#00c568"></i> {{pagedata.store.name || '匿名用户'}}
						
					</div>
					<div class="title btn btn-blue" ng-click="access_json('jy_mapfuwu/manage.store_order/')" style="border-radius: 0.5rem;font-size:0.6rem;color:#fff;background:#cdab6a;margin:0.15rem;height:1rem">我的接单</div>
                </div>
                <a class="jump">
					<div class="jylabel jylabel-switch-label">
							<span class="jylabel-switch {{pagedata.store.busy==1?'active':''}}" ng-click="pagedata.store.busy=1;pagedata.getorder();post({'id':pagedata.store.id,'busy':1},'jy_mapfuwu/index/setonline/');">听单中</span>
							<span class="jylabel-switch {{pagedata.store.busy==0?'active':''}}" ng-click="pagedata.store.busy=0;post({'id':pagedata.store.id,'busy':0},'jy_mapfuwu/index/setonline/');">休息中</span>
					</div>
				</a>
            </div>
	</div>
</div>
<audio id="openvoice" controls preload="auto" style="display:none;">
	<source src="../core/resource/images/neworder.mp3"></source>
</audio>
<script type="text/javascript">
scope.page.height=window.innerHeight
for (var i = 1; i < 10; i++){
 clearInterval(i);
}
if(scope.pagedata.info.show==0){
		var wating_time = 0;
		var hour = 0;
		var min = 0;
		var sec = 0;
		var isnew = false;
		function addTime(){
			wating_time = 0;
			timer = setInterval(function(){
				wating_time = wating_time + 1;
				hour = parseInt(wating_time / (60*60));
				min = parseInt((wating_time-hour * 60*60) / (60));
				//console.log(wating_time);
				if(wating_time>=60){
					sec = wating_time % 60;
				}else{
					sec = wating_time;
				}
				$('.j_timeClock').html(hour+':'+min+':'+sec);
			},1000);
		}
		addTime();
}
window.scope.location(function(res){
		scope.pagedata.info.address = res.address;
		scope.pagedata.lat_lng = res.lat_lng;
		scope.pagedata.getorder(res.lat_lng);
		scope.post_json('jy_mapfuwu/manage.d_wait/dw/',{'latlng':res.lat_lng},function(data){
			require(['map'], function(BMap){
					var map = new BMap.Map("allmap");
					var point = new BMap.Point(res.lat_lng.lng, res.lat_lng.lat);
					map.centerAndZoom(point, 13.6);
			});
		});
		scope.$evalAsync();
});
wait_driver();

require(['jinyun_socket'],function(jinyun_socket){
	jinyun_socket.connect();
	jinyun_socket.onsystem=function(res){
		$("#musicClick")[0].play();
		var info = JSON.parse(res.message);
		scope.pagedata.info.show = 1;
			scope.pagedata.info.mobile = info.mobile;
			scope.pagedata.info.name = info.name;
			scope.pagedata.info.time = info.time;
			scope.pagedata.info.jjuli = info.jjuli;
			scope.pagedata.info.juli = info.juli;
			scope.pagedata.info.price = info.price;
			scope.pagedata.info.orderid =info.orderid;
			scope.pagedata.info.start_seat=info.chufa;
			scope.pagedata.info.dest_seat=info.mudi;
			scope.$evalAsync();
	}
});
function wait_driver(){
	scope.count_down(60,'wait_min','秒','点击重新呼叫');
}
scope.pagedata.getorder=function(lat_lng){
		if(scope.page.action!='manage.d_wait' || scope.pagedata.store.busy==0){
			return false;
		}
		lat_lng=lat_lng?lat_lng:scope.pagedata.lat_lng
		scope.get('jy_mapfuwu/manage.d_wait/getorder/isexi=1&lat='+lat_lng.lat+'&lng='+lat_lng.lng,function(res){
			console.log(res);
			if(res != 'none'){
				res.show=1;
				$("#openvoice")[0].play();
				scope.pagedata.info=res;
				scope.$evalAsync();
			}else{
				setTimeout(function(){
					scope.pagedata.getorder();
				},2000);
			}
		});
}
</script>